<?php

$i = 0;
foreach ($pager->getResults() as $acct_voucher) {



    $data[$i]["id"] = $acct_voucher->getId();
    $data[$i]["cell"] = array(
        $acct_voucher->getId(),
        $acct_voucher->getAcctYear()->getAcctYear(),
        $acct_voucher->getAcctMon(),
        $acct_voucher->getVoucherSn(),
        $acct_voucher->getDebitAmount(),
        $acct_voucher->getCreditAmount(),
        $acct_voucher->getDate(),
        $acct_voucher->getRltOpr()->getFullName(),
    );
    //set status
    if($acct_voucher->getIsCancelled()) {
        $data[$i]["cell"][] = "已取消";
    } elseif($acct_voucher->getIsPosted()) {
        $data[$i]["cell"][] = "已过账";
    } elseif ($acct_voucher->getIsApproved()) {
        $data[$i]["cell"][] = "已审核";
    } else {
        $data[$i]["cell"][] = "未审核";
    }

    //$data[$i]["id"] = $acct_voucher->getId();
    /*$data[$i]["acct_year"] = $acct_voucher->getAcctYear()->getAcctYear();
    $data[$i]["mon"] = $acct_voucher->getAcctMon();
    $data[$i]["voucher_sn"] = $acct_voucher->getVoucherSn();
    $data[$i]["debit_amount"] = $acct_voucher->getDebitAmount();
    $data[$i]["credit_amount"] = $acct_voucher->getCreditAmount();
    $data[$i]["date"] = $acct_voucher->getDate();
    //$data[$i]["opr_name"] = $acct_voucher->getRltOpr()->getFullName();
    $data[$i]["opr_name"] = "a";
    //set status
    $data[$i]["status"] = 'status';
     * 
     */
    $i++;

}

$rlt["page"] = $pager->getPage();   //当前页
$rlt["total"] = $pager->getLastPage();  //总页数
$rlt["records"] = $pager->count();  //总记录数
$rlt["rows"] = $data;    //记录

echo json_encode($rlt);

?>
